﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Infrastructure.Account;

namespace Infrastructure.Helpers
{
    public static class PermissionChecker
    {
        public static bool HasQuyenQuanLyHeThong()
        {
            foreach (var quyen in ActiveAccount.Instance.DanhSachQuyen)
            {
                if (quyen.QuyenConstraint == "001")
                {
                    return true;
                }
            }
            return false;
        }


        public static bool HasQuyenQuanLyDanhMuc()
        {
            foreach (var quyen in ActiveAccount.Instance.DanhSachQuyen)
            {
                if (quyen.QuyenConstraint == "002" || quyen.QuyenConstraint == "001")
                {
                    return true;
                }
            }
            return false;
        }

        public static bool HasQuyenQuanLyHoSo()
        {
            foreach (var quyen in ActiveAccount.Instance.DanhSachQuyen)
            {
                if (quyen.QuyenConstraint == "003" || quyen.QuyenConstraint == "001")
                {
                    return true;
                }
            }
            return false;
        }

        public static bool HasQuyenXemThongTinSinhVien()
        {
            foreach (var quyen in ActiveAccount.Instance.DanhSachQuyen)
            {
                if (quyen.QuyenConstraint == "004" || quyen.QuyenConstraint == "001")
                {
                    return true;
                }
            }
            return false;
        }

        public static bool HasQuyenChinhSuaThongTinSinhVien()
        {
            foreach (var quyen in ActiveAccount.Instance.DanhSachQuyen)
            {
                if (quyen.QuyenConstraint == "005" || quyen.QuyenConstraint == "001")
                {
                    return true;
                }
            }
            return false;
        }

        public static bool HasQuyenThongKe()
        {
            foreach (var quyen in ActiveAccount.Instance.DanhSachQuyen)
            {
                if (quyen.QuyenConstraint == "006" || quyen.QuyenConstraint == "001")
                {
                    return true;
                }
            }
            return false;
        }

        public static bool HasQuyenNhapLieu()
        {
            foreach (var quyen in ActiveAccount.Instance.DanhSachQuyen)
            {
                if (quyen.QuyenConstraint == "005" || quyen.QuyenConstraint == "001" || quyen.QuyenConstraint == "007")
                {
                    return true;
                }
            }
            return false;
        }
    }
}
